package com.lazycat.backend.controller.chat;

import com.alibaba.fastjson.JSONObject;
import com.lazycat.backend.service.chat.GetMessageDoubleEndService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
public class GetMessageDoubleEndController {
    @Autowired
    private GetMessageDoubleEndService getMessageDoubleEndService;

    @PostMapping("chat/getMessageDoubleEnd/")
    public HashMap<String, Object> get(@RequestBody Map<String, String> map) {
        Integer userId1 = Integer.parseInt(map.get("user1_id"));
        Integer userId2 = Integer.parseInt(map.get("user2_id")) ;
        return getMessageDoubleEndService.get(userId1, userId2);
    }
}
